#include "global.h"
#include "hgegui.h"
#include "gui_manager.h"
#include "gui_button.h"

gui_manager::gui_manager()
: gui(new hgeGUI())
{

}

gui_manager::~gui_manager()
{

}

hgeGUI* gui_manager::get_gui()
{
    return gui;
}

void gui_manager::add_button(int group, int guid, char* texfile, int _x, int _y, int width, int height)
{
    gui_button* b = new gui_button(guid, texfile, _x, _y, width, height);
	gui->AddCtrl(b);
	CtrlGroups[guid] = group;
}

gui_button* gui_manager::get_button(int guid)
{
    return (gui_button*)(gui->GetCtrl(guid));
}

void gui_manager::only_active_group(int group)
{
	map<int, int>::iterator iter = CtrlGroups.begin();
    for (; iter != CtrlGroups.end(); iter++)
	{
        get_button(iter->first)->bVisible = (iter->second == group);
	}
}